package com.morgan.test;

import java.util.ArrayList;
import java.util.List;

import com.link.po.Link;

public class CTArrayList {
    
    public static void main (String [] args) {
        
        List<Link> defaultLinkList = new ArrayList<Link>();
        List<Link> originalLinkList = new ArrayList<Link>();
        
        for (int i=0 ; i<5; i++) {
            Link link1 = new Link();
            link1.setId(i);
            link1.setName("Name" + i);
            
            defaultLinkList.add(link1);
        }
        
        for (int i=4 ; i<9; i++) {
            Link link2 = new Link();
            link2.setId(i);
            link2.setName("Name" + i);
            
            originalLinkList.add(link2);
        }
        
        
        for (Link link : defaultLinkList) {
            boolean matchFalg = false;
            for (Link tempLink : originalLinkList) {
                if (link.getId() == tempLink.getId()) {
                    matchFalg = true;
                    break;
                }
            }
            
            if (!matchFalg) {
                originalLinkList.add(link);
            }
        }
        
        System.out.println(originalLinkList.size());
        
        

    }
}
